/* 
 *	Copyright (C) 2009-2010 miaohua
 *	http://code.google.com/p/lrcshower/
 *
 *  This Program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2, or (at your option)
 *  any later version.
 *   
 *  This Program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 *  GNU General Public License for more details.
 *   
 *  You should have received a copy of the GNU General Public License
 *  along with GNU Make; see the file COPYING.  If not, write to
 *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
 *  http://www.gnu.org/copyleft/gpl.html
 *
 */

#pragma once
#include "TypeDef.h"

// Song property index
enum SongPropertyIdx{
     Info_SongName,
     Info_SingerName,
     Info_Album,
     Info_Duration,
     Info_Format,
     Info_BitRate,
     Info_SampleRate,
     Info_Size
};

typedef LONGLONG REFERENCE_TIME;

// Helper tiny functins
// FormatTime: format time like "03:24"
// Now[in]: ms unit
tstring FormatTime(REFERENCE_TIME Now);

// Struct for one song in a play list
struct SongProp
{
   // Constructor
   SongProp(int PropIdx=0);
   SongProp(const tstring & FullPath, int PropIdx=0);
   // Read meida file to get song's property(song name, singer, bitrate, duration, samplerate, format)
   void GetSongProperty();
   // Call it when delete it from play list
   void Invalidate();
   // Get validate flag
   bool IsValidate()const;
   // Get parsed flag
   bool IsParsed()const;
   // Get position index
   int GetIndex()const;
   // Get current song's duration
   REFERENCE_TIME GetDura()const;
   // Get current song's next property
   tstring GetNextProp();
   // Get current song's label(<<songname>>-<<singername>>)
   tstring GetLabel()const;
   // Get current song's name
   tstring GetName()const;
   // Get current song's singer name
   tstring GetSinger()const;
   // Get current song's full path
   tstring GetFullPath()const;
   // Geet current song's tip(assembled by m_SongProperty)
   tstring GetTips()const;
   // Associate lrc file to one song
   static bool SetAssignedLrcFile(const tstring & SongPath, const tstring & LrcPath);
   // Undo associate lrc file to one song
   static bool UnSetAssignedLrcFile(const tstring & SongPath, const tstring & LrcPath);
   // Read assigned song's associated lrc file
   static bool GetAssignedLrcFile(const tstring & SongPath, tstring & LrcPath);
   // Check wether a file is audio file(just according to its ext)
   static bool CheckAudioFile(const tstring & FileName);

   tstring m_Song;                         // Song name
   tstring m_Singer;                       // Singer name
   tstring m_FullPath;                     // Song's full path
   bool m_IsValidate;                      // If deleted, it will be false
   bool m_IsParsed;                        // Indicates wether the song has been parsed( means has read property about the song like singer,album, etc.)
   REFERENCE_TIME m_DurationTime;          // Duration time of the song
   tstring m_SongProperty[Info_Size];      // Property of song (song name, singer, bitrate, duration, samplerate, format)
   int m_PropIndex;                        // Property index to get property in m_SongProperty
   int m_Index;                            // Position in playlist
};